﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Configuration;

namespace EOS.Framework.Web.Mvc
{
    public sealed class MvcConfiguration
    {
        private static MvcConfigurationSection _configuration;
        private static readonly object _padlock = new object();

        public static MvcConfigurationSection Current
        {
            get 
            {
                lock (_padlock)
                {
                    if (_configuration == null)
                    {
                        _configuration = new MvcConfigurationSection();
                    }
                }
                return _configuration; 
            }
        }

        public static void Configure(string sectionName)
        {
            lock (_padlock)
            {
                _configuration = (MvcConfigurationSection)WebConfigurationManager.GetSection(sectionName);
            }
        }
    }
}
